package com.cw.jeeyt.dao.impl.git;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.cw.jeeyt.common.Order;
import com.cw.jeeyt.dao.intf.git.GitUploadSqlRecordDao;
import com.cw.jeeyt.dao.mapper.git.GitUploadSqlRecordMapper;
import com.cw.jeeyt.dao.model.git.GitUploadSqlRecordDo;
import com.cw.lang.common.utils.PageUtil;
import com.cw.lang.common.pagehelper.PageHelper;
import com.cw.lang.mybatis.dto.PageInfo;

/**
 * 上传数据库脚本记录 dao数据库操作接口
 *
 * @author chenw
 * @date 2019-02-25 00:48:07
 */
@Repository
public class GitUploadSqlRecordDaoImpl implements GitUploadSqlRecordDao {
    @Autowired
    private GitUploadSqlRecordMapper gitUploadSqlRecordMapper;

    /**
     * 新增上传数据库脚本记录
     *
     * @param gitUploadSqlRecord
     * @return 整数
     */
    public Integer insert(GitUploadSqlRecordDo gitUploadSqlRecord) {
        return gitUploadSqlRecordMapper.insert(gitUploadSqlRecord);
    }

    /**
     * 新增上传数据库脚本记录不为空的字段
     *
     * @param gitUploadSqlRecord
     * @return 整数
     */
    public Integer insertSelective(GitUploadSqlRecordDo gitUploadSqlRecord) {
        return gitUploadSqlRecordMapper.insertSelective(gitUploadSqlRecord);
    }

    /**
     * 删除上传数据库脚本记录
     *
     * @param gitUploadSqlRecord
     */
    public void delete(GitUploadSqlRecordDo gitUploadSqlRecord) {
        gitUploadSqlRecordMapper.delete(gitUploadSqlRecord);
    }

    /**
     * 修改上传数据库脚本记录不为null的字段
     *
     * @param gitUploadSqlRecord
     */
    public void updateSelective(GitUploadSqlRecordDo gitUploadSqlRecord) {
        gitUploadSqlRecordMapper.updateSelective(gitUploadSqlRecord);
    }

    /**
     * 修改上传数据库脚本记录
     *
     * @param gitUploadSqlRecord
     */
    public void update(GitUploadSqlRecordDo gitUploadSqlRecord) {
        gitUploadSqlRecordMapper.update(gitUploadSqlRecord);
    }

    /**
     * 根据主键查询上传数据库脚本记录
     *
     * @return 上传数据库脚本记录
     */
    public GitUploadSqlRecordDo getById(Long recordId) {
        return gitUploadSqlRecordMapper.getById(recordId);
    }

    /**
     * 查询所有上传数据库脚本记录
     *
     * @return 上传数据库脚本记录集合
     */
    public List<GitUploadSqlRecordDo> queryGitUploadSqlRecordList() {
        return gitUploadSqlRecordMapper.queryGitUploadSqlRecordList();
    }

    /**
     * 分页查询上传数据库脚本记录
     *
     * @param gitUploadSqlRecord 查询条件
     * @param startNum 开始条数
     * @param pageSize 每页长度
     * @return 上传数据库脚本记录集合
     */
    public PageInfo<GitUploadSqlRecordDo> queryByPage(GitUploadSqlRecordDo gitUploadSqlRecord, Integer startNum,
        Integer pageSize, Order order) {
        PageHelper.startPage(PageUtil.calPageNum(startNum, pageSize), pageSize);
        return new PageInfo<>(gitUploadSqlRecordMapper.queryByPage(gitUploadSqlRecord, order));
    }
}
